package com.example.demo.service.impl;

import com.example.demo.config.EventType;
import com.example.demo.config.MessageConfig;
import com.example.demo.message.Message;
import com.example.demo.request.WxRequest;
import com.example.demo.service.EventService;
import org.springframework.stereotype.Service;


@Service
public class EventServiceImpl implements EventService {
    @Override
    public Message getTextMessage(WxRequest wxRequest) {
        String event = wxRequest.getEvent();
        Message message = new Message(wxRequest);
        //关注
        if(EventType.SUBSCRIBE.equals(event)){
            message.setContent(MessageConfig.WELCOME_MESSAGE);
        }

        //取消关注
        if(EventType.UNSUBSCRIBE.equals(event)){
            System.out.println("取消关注");
        }


        return message;
    }
}
